#coding=utf-8
from aliyunsdkcore.client import AcsClient
from aliyunsdkcore.request import CommonRequest

def smsTiXian(openid, money, account, name):
    client = AcsClient('6WP2c9c1jPwk6DBb', 'Y5l2k8GGr8sg6UJCDEhH62IPDiiMPt', 'default')
    request = CommonRequest()
    request.set_accept_format('json')
    request.set_domain('dysmsapi.aliyuncs.com')
    request.set_method('POST')
    request.set_protocol_type('https') # https | http
    request.set_version('2017-05-25')
    request.set_action_name('SendSms')
    request.add_query_param('PhoneNumbers', '13590060134')
    request.add_query_param('SignName', '林煜凡')
    request.add_query_param('TemplateCode', 'SMS_157447280')
    request.add_query_param('TemplateParam', '{"openid":"%s", "money":%s, "account":"%s", "name":"%s"}'%(openid, money, account, name))

    response = client.do_action(request)
    return response

def smssql(reason):
    client = AcsClient('6WP2c9c1jPwk6DBb', 'Y5l2k8GGr8sg6UJCDEhH62IPDiiMPt', 'default')
    request = CommonRequest()
    request.set_accept_format('json')
    request.set_domain('dysmsapi.aliyuncs.com')
    request.set_method('POST')
    request.set_protocol_type('https')
    request.set_version('2017-05-25')
    request.set_action_name('SendSms')
    
    request.add_query_param('PhoneNumbers', '13590060134')
    request.add_query_param('SignName', '林煜凡')
    request.add_query_param('TemplateCode', 'SMS_157448115')
    request.add_query_param('TemplateParam', '{"reason":"%s"}'%(reason))
    
    response = client.do_action(request)
    return response

